home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / graphics / rvga01.zip / VGA_BIOS.C < prev    next >
C/C++ Source or Header  |  1994-08-10  |  2KB  |  113 lines

  1. /**********************************************
  2.  
  3.     VGA BIOS Calls V0.1
  4.     Copyright Reglage (C) 1994
  5.  
  6.     VGArtns.c
  7.  
  8. **********************************************/
  9.  
  10. #include "VGA_BIOS.h"
  11.  
  12.  
  13. UBYTE    VB_Page=0;
  14.  
  15.  
  16.  
  17.  
  18. /**********************************************
  19.  
  20.     BIOS Set 'Graphics' Mode
  21.  
  22. **********************************************/
  23.  
  24. void VB_SetMode(UWORD mode)
  25. {
  26.     asm    mov    ax,mode;
  27.     asm    int    0x10;
  28. }
  29.  
  30.  
  31. /**********************************************
  32.  
  33.     BIOS Get 'Graphics' Mode
  34.  
  35. **********************************************/
  36.  
  37. UWORD VB_GetMode(void)
  38. {
  39.     asm    mov    ah,0x0f;
  40.     asm    int    0x10;
  41.  
  42.     return _AL;
  43. }
  44.  
  45.  
  46. /**********************************************
  47.  
  48.     Set Cursor Type    0: Invisible
  49.                             1:    Full
  50.                             2:    Normal
  51.  
  52.     Change to NO BIOS CALL!
  53.     Let the BIOS library do it's stuff.
  54.  
  55. **********************************************/
  56.  
  57. void VB_SetCursor(UBYTE type)
  58. {
  59.     UBYTE cstart, cend;
  60.  
  61.     switch(type)
  62.     {
  63.         case 0:    cstart=0x20;    cend=0;    break;
  64.         case 1:    cstart=0;        cend=7;    break;
  65.         case 2:    cstart=6;        cend=7;    break;
  66.     }
  67.  
  68.     asm{
  69.         mov    ch,cstart;
  70.         mov    cl,cend;
  71.         mov    ah,1;
  72.         int    0x10;
  73.     }
  74. }
  75.  
  76.  
  77. /**********************************************
  78.  
  79.     Set Cursor Position
  80.  
  81.     Bug: Does not work with T_width other than 80!
  82.     Correction: Use VGA ports to change address pointer for Cursor! :)
  83.  
  84. **********************************************/
  85.  
  86. void VB_SetCursorPos(UBYTE x,UBYTE y)
  87. {
  88.     asm{
  89.         mov    ah,0x02;
  90.         mov    bh,0x00;
  91.         mov    dl,x;
  92.         mov    dh,y;
  93.         int    0x10;
  94.     }
  95. }
  96.  
  97. /**********************************************
  98.  
  99.     Get Cursor Position
  100.  
  101. **********************************************/
  102.  
  103. void VB_GetCursorPos(UBYTE *x,UBYTE *y)
  104. {
  105.     asm{
  106.         mov    ah,0x03;
  107.         mov    bh,VB_Page;
  108.         int    0x10;
  109.     }
  110.     *x=_DL;
  111.     *y=_DH;
  112. }
  113.